#include "CommandsTest.h"
#include "Commands.h"
#include "Timeout.h"

CPPUNIT_TEST_SUITE_REGISTRATION(CommandsTest);

void CommandsTest::setUp() {
	START_TIMEOUT(1000);
}

void CommandsTest::tearDown() {
	STOP_TIMEOUT();
}

void CommandsTest::testParse() {
	CPPUNIT_ASSERT(COMMAND_RESTART == Commands::parse("restart"));
	CPPUNIT_ASSERT(COMMAND_TOP == Commands::parse("top"));
	CPPUNIT_ASSERT(COMMAND_EXIT == Commands::parse("exit"));
	CPPUNIT_ASSERT(COMMAND_MOVE_LEFT == Commands::parse("l"));
	CPPUNIT_ASSERT(COMMAND_MOVE_LEFT == Commands::parse("L"));
	CPPUNIT_ASSERT(COMMAND_MOVE_RIGHT == Commands::parse("r"));
	CPPUNIT_ASSERT(COMMAND_MOVE_RIGHT == Commands::parse("R"));
	CPPUNIT_ASSERT(COMMAND_MOVE_UP == Commands::parse("u"));
	CPPUNIT_ASSERT(COMMAND_MOVE_UP == Commands::parse("U"));
	CPPUNIT_ASSERT(COMMAND_MOVE_DOWN == Commands::parse("d"));
	CPPUNIT_ASSERT(COMMAND_MOVE_DOWN == Commands::parse("D"));
	CPPUNIT_ASSERT(COMMAND_INVALID_COMMAND == Commands::parse("invalid"));
}
